home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / module-init-tools.postrm < prev    next >
Encoding:
Text File  |  2007-04-03  |  1.8 KB  |  79 lines

  1. #!/bin/sh -e
  2.  
  3. TO_DIVERT="depmod insmod update-modules modinfo"
  4. TO_DIVERT_NOMAN="kallsyms ksyms"
  5. TO_DIVERT_L="lsmod modprobe rmmod"
  6.  
  7. undivert_gen() {
  8.     DEXT=${3:-modutils}
  9.     dpkg-divert --remove --rename --package module-init-tools \
  10.     --divert $2/$1.$DEXT $2/$1 > /dev/null
  11. }
  12.  
  13. undivert_man() {
  14.     DSECTION=${2:-8}
  15.     for locale in '' fr/; do
  16.     dpkg-divert --remove --rename --package module-init-tools --divert \
  17.         /usr/share/man/${locale}man$DSECTION/$1.modutils.$DSECTION.gz \
  18.         /usr/share/man/${locale}man$DSECTION/$1.$DSECTION.gz > /dev/null
  19.     done
  20. }
  21.  
  22. remove_compat_symlinks() {
  23.     SYMLINKS_TO_REMOVE="/bin/lsmod.modutils /sbin/ksyms /sbin/kallsyms"
  24.     for file in $SYMLINKS_TO_REMOVE; do
  25.     [ -L $file ] && rm $file
  26.     done
  27.     return 0
  28. }
  29.  
  30. remove_etc_files() {
  31.     # created by postinst
  32.     # do not remove it if the modutils package is installed
  33.     [ ! -f /etc/init.d/modutils ] && rm -f /etc/modules
  34.     # /etc/modutils.conf is created by update-modutils
  35.     rm -f /etc/modutils.conf /etc/modprobe.d/arch-aliases
  36.     rmdir --ignore-fail-on-non-empty /etc/modprobe.d/
  37. }
  38.  
  39. case "$1" in
  40.     remove)
  41.     remove_compat_symlinks
  42.  
  43.     for cmd in $TO_DIVERT; do
  44.         undivert_gen $cmd /sbin
  45.         undivert_man $cmd
  46.     done
  47.     for cmd in $TO_DIVERT_NOMAN; do
  48.         undivert_gen $cmd /sbin
  49.     done
  50.     for cmd in $TO_DIVERT_L; do
  51.     rm -f /sbin/$cmd.modutils
  52.         undivert_gen $cmd /sbin Lmodutils
  53.         undivert_man $cmd
  54.     done
  55.     undivert_man modules 5
  56.     ;;
  57.  
  58.     purge)
  59.     remove_etc_files
  60.     ;;
  61.  
  62.     upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
  63.     ;;
  64.  
  65.     *)
  66.     echo "$0 called with unknown argument '$1'" >&2
  67.     exit 1
  68.     ;;
  69. esac
  70.  
  71. # Automatically added by dh_installinit
  72. if [ "$1" = "purge" ] ; then
  73.     update-rc.d module-init-tools remove >/dev/null || exit $?
  74. fi
  75. # End automatically added section
  76.  
  77.  
  78. exit 0
  79.